home *** CD-ROM | disk | FTP | other *** search
- /*
- * Routine to narrow the gap in losing signals. (Makes checking task queue
- * atomic). The method is due to Eric Jul, April 1986.
- *
- * >>> WARNING <<<
- * As any dolt can see, these routines are EXTREMELY machine dependent.
- * Be very careful what you do with them. This code must be run through
- * the C-preprocessor (/lib/cpp) in order to work. Note the use of
- * C-style comments.
- *
- * First the machine independent stuff.
- */
- .globl _dontPause
- .globl _reallyPause
- .globl _emPause
- .globl _shouldPause
- /*
- * Now the VAX specific part.
- *
- * When no task is in the EmKernel task queue, _shouldPause is set to
- * _reallyPause, so that a SIGPAUSE Unix system call will take place, causing
- * the EmKernel to pause until a Unix signal is received. When the task
- * queue becomes non-empty, _shouldPause is set to _dontPause, so that
- * essentially the operation of the emPause routine is a NOP (entry vector
- * 132).
- */
- #if defined(vax)
- /* Unix SIGPAUSE entry vector */
- .set SIGPAUSE, 111
- .data
-
- .align 2
- _dontPause:
- ret
- ret
- ret
- ret
- .long 0
- .long 0
-
- .align 2
- _reallyPause:
- chmk $SIGPAUSE
- ret
- .long 0
- .long 0
-
- .align 2
- _shouldPause:
- chmk $SIGPAUSE
- ret
- .long 0
-
- .text
- .align 2
- /*
- * We are passed one parameter (usually 0) which represents
- * the signals which will NOT wake us up.
- */
- _emPause:
- .word 0x0000
- jmp _shouldPause
- ret
- #endif
- /*
- * Now the SUN specific part. Note that this uses a very
- * different mechanism to achieve its aims.
- *
- * When no task is in the Kernel task queue, _shouldPause is set to
- * _reallyPause, so that a PAUSE Unix system call will take place, causing
- * the Kernel to pause until a Unix signal is received. When the task
- * queue becomes non-empty, _shouldPause is set to _dontPause, so that
- * essentially the operation of the emPause routine is a NOP. (This is
- * self-modifying code).
- */
- #if defined(sun)
- PAUSE = 111 | Unix system call code
-
- .even
- .data | put this code in data region so that
- | we can make it self modifying
-
- _dontPause:
- addql #4,sp
- _reallyPause:
- trap #0
-
- _emPause:
- pea PAUSE
- _shouldPause:
- trap #0
- rts
- #endif
-